import { GameContextEventMgr } from "../GameContextEventMgr";
import { GlobalObj, IMClothesShop } from "../obj/GlobalObj";
import { PGCServer } from "../PGCServer";
import { GameTool } from "../tool/GameTool";
import { DressUpNoteMgr } from "./data/DressUpNoteMgr";
import { DressUpServerDataMgr } from "./data/DressUpServerDataMgr";
import { FaceEditInit } from "./FaceEditInit";

export class MDressUpAvatarMgr {


    mClotheMgr: IMClothesShop;
    editInitCls: any;
    faceEditCls: any;
    faceSerializeCls: any;

    configMgr: ClassifyDataManager;

    faceEdit: FaceEdit;
    avatar: any;
    camera: Laya.Camera;

    private _curDisType: number;


    private _defalutHead: any;// 默认头部数据

    private _avatarHeadMesh: any; // 换装的头部
    private _useEditFace: boolean;// 是否使用了可以编辑的脸部

    /** 默认avatar换装数据 */
    private _defaultAvatarJson: any;


    private _needSaveAvatar: boolean; // 有过装扮修改
    /** 需要保存装扮 */
    private _needSaveDressUp: boolean;

    noteMgr:DressUpNoteMgr;

    private static _ins: MDressUpAvatarMgr;



    static get Ins(): MDressUpAvatarMgr {
        return this._ins ||= new MDressUpAvatarMgr();
    }

    /**
     * 
     * @param mclothMgr 
     * @param editInitCls Logic.FaceEditInit
     * @param faceEditCls MetaX.FaceEdit
     * @param params [MetaX.FaceSerialize,MetaX.FaceOperation,MetaX.FacePartDefine]
     */
    init(mclothMgr: any, editInitCls: any, faceEditCls: any, params: any[]) {
        this.mClotheMgr = mclothMgr;
        this.editInitCls = editInitCls;
        this.faceEditCls = faceEditCls;
        this.faceSerializeCls = params[0];
        // this.faceSerializeCls = params[1];
        // this.faceSerializeCls = params[2];
        this.configMgr = params[3];
        FaceEditInit.MakeupEdit = params[4];
        FaceEditInit.FaceEditLoader = params[5];
        DressUpServerDataMgr.configMgr = params[3];

        DressUpServerDataMgr.Ins.clear();
        DressUpServerDataMgr.Ins.initMap();
        this.mClotheMgr.initAvatarTabList(Laya.Handler.create(this, () => {
            console.log("获取了avatar 部件数据集合")
        }));
        // let getAvatarDataJson = this.mClotheMgr.getAvatarDataJson;
        // this.mClotheMgr.getAvatarDataJson = ()=>{
        //     console.log("nars接管的 json");
        //     let itemProp = getAvatarDataJson.bind(this.mClotheMgr)();
        //     itemProp[this.noteMgr.dressUpKey] = this.noteMgr.getFacePartObj();
        //     return itemProp;
        // }
    }
    /**
     * 创建主角
     * @param box 父节点
     * @param type 0:近距离  1：远距离
     */
    public createRole(box: Laya.Box, needFace: boolean) {
        if (GlobalObj.dressState == 1) {
            this.needSaveAvatar = false; // 交易的情况下不保存数据
            return
        }                 
        // 交易状态打开的界面不创建角色
        MDressUpAvatarMgr.Ins.clearRoleAvatar();

        if (needFace) {
            if (!this._defaultAvatarJson) {
                let url = GlobalObj.SERV_URL + "defaultAvatar/" + (GlobalObj.isFa() ? "fa.json" : "ma.json");
                Laya.loader.load(url, Laya.Handler.create(this, (data: any) => {
                    if (data.data) {
                        this._defaultAvatarJson = data.data;
                        this.needSaveAvatar = false;
                        this._needSaveDressUp = false;
                        this.mClotheMgr.createAvatar(box, Laya.Handler.create(this, this.addFace));
                    } else {
                        console.error("加载json失败  avatar json ");
                    }

                }), null, Laya.Loader.JSON);
            } else {
                this.needSaveAvatar = false;
                this._needSaveDressUp = false;
                this.mClotheMgr.createAvatar(box, Laya.Handler.create(this, this.addFace));
            }
        } else {

            this.mClotheMgr.createAvatar(box, null);
        }
    }

    public clearRoleAvatar() {
        let clotheMgr = this.mClotheMgr as any;
        clotheMgr.needClear = false;

        if (clotheMgr.roleAvatar) {
            clotheMgr.roleAvatar.onDestroy();
            clotheMgr.roleAvatar = null;
        }
        if (clotheMgr.roleParent) {
            clotheMgr.roleParent.destroy();
            clotheMgr.roleParent = null;
        }
    }

    /**
     * 
     * @param type 0:近距离  1：远距离
     */
    public changeCameraDistance(type: number) {
        this._curDisType = type;
        if (!this.camera || this.camera.destroyed) {
            return;
        }

        let vec = this.camera.transform.localPosition;
        if (type) {
            // vec.setValue(0, 1.03, 2);
            vec.setValue(0, 0.8, 1.7);
        } else {
            // let zDis = GlobalObj.isFa()?0.5:0.7;
            // let zDis = GlobalObj.isFa()?0.5:0.7;
            vec.setValue(0, 1.5, 1.1);
        }
        this.camera.fieldOfView = type?60:30;
        this.camera.transform.localPosition = vec;
    }


    private addFace() {
        if (this.faceEdit) return;
        this.avatar = this.mClotheMgr.roleAvatarMgr.avatar;
        this.camera = this.avatar.parent.getChildAt(0);
        this.camera.transform.localRotationEuler = new Laya.Vector3(0, 0, 0);
        this.camera.nearPlane = 0.1;
        let initface = new FaceEditInit(this.faceEditCls);
        let avatarJson = this.mClotheMgr.getAvatarDataJson();
        let isFa = GlobalObj.isFa();
        console.log("骨架信息: " + avatarJson.avatarUrl + "  默认的信息:" + initface.baseAvatarUrl);
        initface.baseAvatarUrl = avatarJson.avatarUrl; // 骨架信息
        console.log("初始化 性别数据 是否是女的:" + isFa);


        this.changeCameraDistance(this._curDisType);

        let light = this.camera.parent.parent.getChildAt(0) as Laya.DirectionLight;
        this.camera.addChild(light);
        light.transform.localRotationEuler = new Laya.Vector3(-35, -48, 0);
        light.intensity = 0.4;
        initface.init(isFa, Laya.Handler.create(this, (edit1: any) => {//note 不能使用edit 名字和js文件名字冲突了
            let roleChanger = this.mClotheMgr.roleAvatarMgr.roleChanger;
            if (!roleChanger || !this.avatar) {
                return;
            }

            roleChanger.defaultAvatar = this._defaultAvatarJson;
            let defaultAvatarMap = roleChanger.defaultAvatarMap;

            for (const key in this._defaultAvatarJson) {
                const value = this._defaultAvatarJson[key];
                let tab = parseInt(key);
                if (tab >= 0) {
                    defaultAvatarMap.set(tab, value);
                }
            }

            this._defalutHead = (<Map<number, any>>roleChanger.currentParts).get(0);
            this.faceEdit = edit1;

            // this.faceEdit.makeupEdit.isMakeUpTex = false;
            this.__refreshDressPrefabData(avatarJson);
            this._needSaveDressUp = false;
            this.avatar.addChild(this.faceEdit.root);
            let ani: Laya.Animator = this.avatar.avatarSprite.animator;
            ani.play("idle", 0, 0);
            if (this.avatar._avatar3dSprite.animator._controllerLayers[0]) {
                let url = this.avatar._avatar3dSprite.animator._controllerLayers[0]._statesMap['idle']._clip.url;
                this._headAddAnimationState(url, "idle");
            }
            this.refreshMeshState(this._useEditFace, true);
        }));
    }

    private _headAddAnimationState(url: string, aniName: string) {
        let clip = Laya.loader.getRes(url);
        let sprite = this.faceEdit.root;
        let animator = sprite.getComponent(Laya.Animator);
        if (!animator) {
            animator = sprite.addComponent(Laya.Animator);
        }
        let controllerLayer = animator.getControllerLayer(0);
        if (!controllerLayer) {
            controllerLayer = new Laya.AnimatorControllerLayer("top");
            animator.addControllerLayer(controllerLayer);
        }
        let state = controllerLayer.getAnimatorState(aniName);
        if (!state) {
            state = new Laya.AnimatorState();
            state.name = aniName;
            state.clip = clip;
            if (clip)
                state.clip.islooping = true;
            controllerLayer.addState(state);
        }
        animator.play(aniName, 0, 0);
    }

    /** 是否穿戴 */
    public isWear(id: number) {//TODO 是否穿戴了该物品
        let roleChanger = this.mClotheMgr.roleAvatarMgr.roleChanger;
        let bondIds = roleChanger.findBoneIdToShopID([id]);
        if (bondIds && bondIds.length) {
            // 已经换上了该部位
            console.log("已经换上了该部位" + id);
            return true;
        }
        return false;
    }

    /** 更新头部的显示对象 
     * @param useFace 使用捏出来的脸
     * @param force 是否强制设置active
    */
    public refreshMeshState(useFace: boolean, force?: boolean) {
        this._useEditFace = useFace;
        if (this.avatar) {
            this._avatarHeadMesh = this.avatar.getChildByName("RootNode").getChildAt(1).getChildAt(0);
            if ((this.faceEdit && this.faceEdit.root.active !== useFace) || force) {
                this._avatarHeadMesh.active = !useFace;
                this.faceEdit.root.active = useFace;
                let ani: Laya.Animator = this.avatar.avatarSprite.animator;
                if (ani) {
                    ani.play("idle", 0, 0);
                }

                let sprite = this.faceEdit.root;
                let animator = sprite.getComponent(Laya.Animator);
                if (animator) {
                    animator.play("idle", 0, 0);
                }
            }
            if (useFace) {
                // 删除头部数据
                (<Map<number, any>>this.mClotheMgr.roleAvatarMgr.roleChanger.currentParts).delete(0);
                (<Map<number, any>>this.mClotheMgr.roleAvatarMgr.roleChanger.beginParts).delete(0);
                (<Map<number, any>>this.mClotheMgr.roleAvatarMgr.roleChanger.defaultAvatarMap).delete(0);
            } else if (this._defalutHead) {
                (<Map<number, any>>this.mClotheMgr.roleAvatarMgr.roleChanger.currentParts).set(0, this._defalutHead);
                (<Map<number, any>>this.mClotheMgr.roleAvatarMgr.roleChanger.beginParts).set(0, this._defalutHead);
                (<Map<number, any>>this.mClotheMgr.roleAvatarMgr.roleChanger.defaultAvatarMap).set(0, this._defalutHead);
            } else {
                console.warn("没有头部部位数据");
            }
        } else {
            console.warn("销毁了---- avatarHeadMesh");
        }

    }

    public setDressUpPrefab(url: string) {
        this.refreshMeshState(true);
        this._needSaveDressUp = true;
        Laya.loader.load(url, Laya.Handler.create(this, (data: any) => {
            if (data && this.faceEdit) {
                this.faceSerializeCls.deserializePartEditData(this.faceEdit, data.data);
            }
        }), null, Laya.Loader.BUFFER);
    }


    addChange(url: string) {
        let eff = Laya.loader.getRes(url, Laya.Loader.TEXTURE2D);
        let tex = new Laya.Texture(eff);
        return tex;
    }

    /** 更新avatar和预制体 */
    public setAvatarData(boneData: any) {// 设置模板数据
        if (boneData) {
            if (boneData[0])
                this._defalutHead = boneData[0]; // 存上
            this.__refreshDressPrefabData(boneData);
            this.refreshMeshState(this._useEditFace);
            this._needSaveDressUp = true;
            // delete boneData[0]; // 删除，是不导致 avatar数据创建头部
            this.mClotheMgr.roleAvatarMgr.roleChanger.changeAvatarData(boneData);
        }
    }


    /** 刷新妆容预制体数据 */
    private __refreshDressPrefabData(avatarJson: any) {
        if (avatarJson) {
            this._useEditFace = avatarJson[0] && avatarJson[0].shopId == -1;
            if (this._useEditFace) {
                let headLhUrl: string = avatarJson[0].url;
                this.noteMgr.clear();
                let dressUpDatas = avatarJson[0][this.noteMgr.dressUpKey];
                for (const key in dressUpDatas) {
                    let partType = parseInt(key);
                    this.noteMgr.updateDressUpMap(partType, dressUpDatas[key]);
                    this.noteMgr.addByPart(partType, dressUpDatas[key]);
                }
                this.noteMgr.loadCacheDressDatas();
                delete avatarJson[0];
                let idx = headLhUrl.lastIndexOf("/");
                let abUrl = headLhUrl.substring(0, idx + 1) + "data.ab";
                abUrl = PGCServer.ins.formatUrl(abUrl);
                this.setDressUpPrefab(abUrl);
            }
        }
    }

    // static cunEyeSkin = "";
    // static cunCheekSkin = "";
    // static cunMouseSkin = "";

    public getAvatarJson(callback: Laya.Handler): void {
        console.log("this.closeing  save 10:getAvatarJson 01");

        if (!this.faceEdit) return callback && callback.runWith(null);
        console.log("this.closeing  save 10:getAvatarJson 02");
        let tempFaceObj = this.noteMgr.getDressUpHeadData({}); // 不让数据收到时序的控制出现未知bug
        let avatarJson = this.mClotheMgr.getAvatarDataJson();
        if (this._useEditFace && this._needSaveDressUp) {
            console.log("this.closeing  save 10:getAvatarJson pgc_uploadFaceFile");
            GameContextEventMgr.sendGlobalEvent("pgc_uploadFaceFile", [this.faceEdit, Laya.Handler.create(this, (res: any) => {
                console.log("this.closeing  save 10:getAvatarJson pgc_uploadFaceFile over");
                if (res && !res.ret) {
                    avatarJson[0] = { tab: 0, shopId: -1 };
                    if (avatarJson[0]) {
                        avatarJson[0].url = res.data[0];
                        avatarJson[0][this.noteMgr.dressUpKey] = tempFaceObj[this.noteMgr.dressUpKey];
                    }
                } else {
                    avatarJson[0] = this._defalutHead;
                }
                console.log("保存数据   avatarJson:", avatarJson);
                GlobalObj.useData.avatar_show = JSON.stringify(avatarJson);
                callback.runWith(avatarJson);
                console.log("使用捏脸数据", avatarJson);
            })]);
        } else {
            console.log("this.closeing  save 10:getAvatarJson 03");
            if (this._defalutHead) {
                avatarJson[0] = this._defalutHead;
                if (avatarJson[0] && avatarJson[0].shopId != this._defalutHead.shopId) {
                    console.log("有变化------------------------------------------>", this._defalutHead);
                }
            }
            GlobalObj.useData.avatar_show = JSON.stringify(avatarJson);
            console.log("没使用捏脸数据", avatarJson);
            callback.runWith(avatarJson);
        }
    }

    // （部位，参数，方向）
    public _changeValue(_curDefine: any, value: number, _curOperate: FaceOperation) {
        if (!_curDefine) {
            console.log("请选择部位")
            return;
        }
        let data = value;
        if (_curDefine == FacePartDefine.Eye) {
            this.faceEdit.changeMatProps(_curOperate, data);
        } else {
            this.faceEdit.moveBone(_curDefine, data, _curOperate, 0);
        }
    }

    


    /** 获取avatar tab数据 name:tag_name tag:tab*/
    public getAvatarTabDatas(): any[] {
        return this.mClotheMgr.avatarTabDatas;
    }

    /** 设置属性切图 */
    public changeMatPropsByTex(type: number, url: string) {
        if (url) {// 有贴图数据，没有颜色也生效
            this.refreshMeshState(true);

            this._needSaveDressUp = true;

            let eff = Laya.loader.getRes(url, Laya.Loader.TEXTURE2D);
            if (eff) {
                this.faceEdit.changeMatProps(type, this.addChange(url).bitmap);
                return;
            }
            let urlObj = { url: url, constructParams: [0, 0, 1, true, false, true], type: Laya.Loader.TEXTURE2D };
            //@ts-ignore
            Laya.loader.load(urlObj, Laya.Handler.create(this, () => {
                if (this.faceEdit) {
                    this.faceEdit.changeMatProps(type, this.addChange(url));
                }
            }));
        }
    }

    /** 清理部位贴图 */
    public clearDiffPart(part: FacialOrgan) {
        this.faceEdit.changeDiffPart(part, null);
        this.faceEdit.updateMakeup();
    }

    /** 清理材质参数 */
    public clearMatProps(prop: FaceOperation) {
        this.faceEdit.clearMatProps(prop);
    }

    /** 清理部位数据 */
    public clearEditDataByParts(parts: FacePartDefine[]) {
        this.faceEdit.clearEditDataByParts(parts);
    }


    /**
     * 根据部位id变更脸部mask贴图
     * @param part 
     * @param url 
     */
    public changeMaskTex(part: FacialOrgan, url: string) {
        let textureParam = [0, 0, 1, true, false, false];

        this._createTexture(url, textureParam, Laya.Handler.create(this, (tex:Laya.Texture)=>{
            if (this.faceEdit) {
                this.faceEdit.changeMaskPart(part, tex);
                this.faceEdit.updateMakeup();
            }
        }));
    }

    /**
     * 修改妆容颜色和贴图
     * @param color 
     * @param url 
     * @param type 
     */
    public changeDressUp(color: string[], url: string, type: number) {
        this.refreshMeshState(true);
        this._needSaveDressUp = true;
        let colorStr: string, alpha: number;
        if (color) {
            let arr = GameTool.getRGBStr(color);
            colorStr = arr[0][0];
            alpha = arr[1][0];
            console.log("颜色透明度alpha:" + alpha);
        }
        if (url) {// 有贴图数据，没有颜色也生效
            let textureParam = [0, 0, 1, true, false, true];
            this._createTexture(url, textureParam, Laya.Handler.create(this, (tex:Laya.Texture)=>{
                if (this.faceEdit) {
                    this.faceEdit.changeDiffPart(type, tex, colorStr, alpha);
                    this.faceEdit.updateMakeup();
                }
            }));
            
        } else {
            switch (type) {
                case FaceOperation.EyelashColor: // 睫毛需要特殊处理
                    this.faceEdit.changeMatProps(type, color && GameTool.getColorObj(color)[0]);
                    break;

                case FaceOperation.EyesColor: // 眼睛
                    this.faceEdit.changeMatProps(type, color && GameTool.getColorObj(color)[0]);
                    break;


                default: // 其他部位都只是 获取之前的贴图直接改变颜色
                    let tex = this.faceEdit.makeupEdit.getDiffPart(type);
                    this.faceEdit.changeDiffPart(type, tex, colorStr, alpha);
                    this.faceEdit.updateMakeup();
                    break;
            }
        }
    }

    /**
     * 
     * @param url 
     * @param sRGB 
     * @param callback 
     * @returns 
     */
    private _createTexture(url: string, constructParams:any, callback: Laya.Handler) {
        if(! url){
            callback && callback.runWith(null);
            return;
        }
        let eff = Laya.loader.getRes(url, Laya.Loader.TEXTURE2D);
        if (!eff) {

            let urlObj = { url: url, constructParams: constructParams, type: Laya.Loader.TEXTURE2D };
            // let urlObj = { url: url, constructParams: [0, 0, 1, true, false, sRGB], type: Laya.Loader.TEXTURE2D };
            //@ts-ignore
            Laya.loader.load(urlObj, Laya.Handler.create(this, () => {
                callback && callback.runWith(this.addChange(url));
            }));
        }else{
            callback && callback.runWith(this.addChange(url));
        }

    }


    /** 切换单个部位的部件 */
    public changeClothe(goodsData: any, isUse: boolean): void {
        if (goodsData && goodsData.is_has && goodsData.preform_file) {
            // let avatarJson = MDressUpAvatarMgr.Ins.mClotheMgr.getAvatarDataJson();
            let isWear = this.isWear(goodsData.preform_id);
            let roleChanger = MDressUpAvatarMgr.Ins.mClotheMgr.roleAvatarMgr.roleChanger;
            if (isWear && isUse) {
                // 已经换上了该部位, 且使用该部位
                return;
            }
            let tags = (<string>goodsData.system_tag_ids).split(",");
            if (tags && tags.length) {
                let avatarTags = DressUpServerDataMgr.Ins.avatarTags;
                let tabs = MDressUpAvatarMgr.Ins.getAvatarTabDatas();
                let tagName: string;
                for (let index = 0; index < tags.length; index++) {
                    const tag = tags[index];
                    tagName = avatarTags[parseInt(tag)];
                    if (tagName) {
                        break;
                    }
                }
                let isFace = tagName && tagName == "脸部";
                if (isFace) { // 头部不进行替换
                    this.refreshMeshState(false);
                }
                let item = tabs.find(tab => tab.name == tagName);
                if (item && isUse) {
                    let url: string = goodsData.preform_file;
                    let dataObj: any = {};
                    dataObj["tab"] = item.tag;
                    dataObj["url"] = url.replace(".dat", ".lh");
                    dataObj["shopId"] = goodsData.preform_id;
                    if (goodsData.preform_id == 34342 || goodsData.preform_id == 33836) {
                        dataObj["del"] = [4];
                    }
                    roleChanger.changeRolePart(dataObj);
                    if(isFace) this._defalutHead = dataObj;
                } else if (item) {
                    let bondIds = roleChanger.findBoneIdToShopID([goodsData.preform_id]);
                    if (bondIds.length) {
                        bondIds = bondIds.concat(roleChanger.findBoneDelBoneId(bondIds));
                    }
                    roleChanger.recoverAlone(bondIds, true);
                }
            }
        } else {
            console.log("没能换装的数据:", goodsData);
        }

    }

    /** 保存装扮数据 */
    public saveDressUpAvatar(callback?: Laya.Handler) {
        console.log("this.closeing  save 0-----");
        if (this._needSaveAvatar) {

            this.getAvatarJson(Laya.Handler.create(this, (json: any) => {
                if (!this.mClotheMgr.roleAvatarMgr.roleChanger || !json) {
                    this.clearRoleAvatar();
                    this.noteMgr.clear();
                    console.log("this.closeing  save 1:");
                    callback && callback.run();
                    return;
                }
                // MDressUpAvatarMgr.Ins.mClotheMgr.roleAvatarMgr.saveAvatarData(json);
                if (json[0]) { // 添加头部数据到avatar里面
                    (<Map<number, any>>this.mClotheMgr.roleAvatarMgr.roleChanger.currentParts).set(0, json[0]);
                }

                if (typeof json !== "object") {
                    debugger;
                    console.error("json :", json,);
                    alert("保存数据失败 error")
                }
                console.log("this.closeing  save 2:");
                this.mClotheMgr.saveRoleBoneParts();
                this.mClotheMgr.startClear();
                this.noteMgr.clear();
                callback && callback.run();
            }));
        } else {
            console.log("this.closeing  save 3:");
            this.clearRoleAvatar();
            this.noteMgr.clear();
            console.log("没有修改捏脸数据不需要存储数据");
            callback && callback.run();
        }
    }

    public set needSaveAvatar(value: boolean) {
        this._needSaveAvatar = value;
        console.log("有了装扮上的修改---" + value);
    }
    public get needSaveAvatar() {
        return this._needSaveAvatar;
    }

    clear() {
        if (this.faceEdit) {
            this.faceEdit.destroy();
            this.faceEdit = null;
        }
        this._avatarHeadMesh = null;
        this.camera = null;
        this.avatar = null;
    }
}



export enum OperationColor {
    /** 眼睛的颜色 */
    EYE_COLOR,
    /** 眼影颜色 */
    EYE_SHADOWN_COLOR,
    /** 睫毛颜色 */
    JIE_MAO_COLOR,
    /** 嘴颜色 */
    MOUTH_COLOR,
    /** 腮红 */
    BLUSHER_COLOR,
}

export enum FacePartDefine{
    /** 额头 */
    Forehead  = 1,
    /** 苹果肌 sutura zygomaticomaxillaris */
    SutureZygo,
    /** 下巴 */
    Chin,
    /** 颧骨  */
    Malar,
    /** 脸颊 */
    Cheek,
    /** 下颌 */
    Mandible,
    /** 下颌角 */
    AngleOfMandible,
    /** 眉头 */
    Eyebrow,
    /** 眉尾 */
    EyebrowTail,
    /** 眉间 */
    BetweenEyebrow,
    /** 上眼皮 */
    Upperyelid,
    /** 下眼皮 */
    Loweryelid,
    /** 内眼角 */
    InnerCanthus,
    /** 外眼角 */
    OuterCanthus,
    /** 鼻头 */
    Noseguard,
    /** 鼻翼 */
    NasalAlar,
    /** 鼻梁 */
    NoseBridge,
    /** 鼻底 */
    NasalBase,
    /** 嘴角 */
    MouthCorners,
    /** 上唇中 */
    UpperLipMiddle,
    /** 上唇两侧 */
    UpperLipBothSides,
    /** 下唇中 */
    LowerLipMiddle,
    /** 下唇两侧 */
    LowerLipBothSides,
    /** 眼睛相关 */
    Eye,
    /** 眉毛整体 */
    Whole_Eyebrow,
    /** 眼睛整体 */
    Whole_Eye,
    /** 鼻子整体 */
    Whole_Nose,
    /** 嘴巴整体  */
    Whole_Mouth
}

export enum FaceOperation{
    /** 移动上下 */
    MUpAndDown = 1,
    /** 移动前后 */
    MFrontAndBack,
    /** 移动内外 */
    MLeftAndRight,

    /** 旋转上下 */
    RUpAndDown,
    /** 旋转前后 */
    RFrontAndBack,
    /** 旋转内外 */
    RLeftAndRight,

    /** 缩放上下 */
    SUpAndDown,
    /** 缩放前后 */
    SFrontAndBack,
    /** 缩放内外 */
    SLeftAndRight,

    /** 眼睛大小 */
    EyesSize,
    /** 瞳孔大小 */
    PupilSize,
    /** 眼睛颜色 */
    EyesColor,

    /** 虹膜贴图 */
    IrisTexture,
    /** 睫毛贴图 */
    EyelashTexture,
    /** 睫毛颜色 */
    EyelashColor,
    /** 皮肤细节 */
    SkinDetail,
    /** 皮肤光滑度 */
    SkinSmoothness,
    /** 皮肤颜色 */
    SkinColor,
}

/**
 * 脸部器官
 */
export enum FacialOrgan{
    /** 背景 */
    Base,
    //额头
    Forehead,
    //鼻子
    Nose,
    /** 眉毛 */
    EyeBrow,
    //眼
    Eye,
    /** 修容 */
    Bronzer,
    //嘴巴
    Mouse,
    //脸颊
    Cheek,
    /** 眼皮 */ 
    Eyelid,
    /** 眼影 */ 
    EyeShadow,
    /** 眼线 */ 
    EyeLiner,
    /** 定妆 */
    Fixing,
}
